package com.itheima.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.domain.Student;
import com.itheima.mapper.StudentMapper;
import jdk.nashorn.internal.ir.annotations.Ignore;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author 王加鑫
 * @Date 2021/08/18 22:37
 * @Since JDK 1.8
 */
@Transactional
@Service
@Ignore
public class StudentServiceImpl implements StudentService{

    @Autowired
    private StudentMapper studentMapper;


    @Override
    public PageInfo findAll(int page, int pageSize) {
        PageHelper.startPage(page,pageSize);
        List<Student> all = studentMapper.findAll();
        return new PageInfo(all);
    }

    @Override
    public Student findStudentById(String number) {
        return studentMapper.findStudentById(number);
    }

    @Override
    public int save(Student student) {
        return studentMapper.save(student);
    }

    @Override
    public int update(Student student) {
        return studentMapper.update(student);
    }

    @Override
    public int delete(String number) {
        return studentMapper.delete(number);
    }
}
